package com.lxg.service.historyService.impl;

import com.lxg.dao.HistoryDao;
import com.lxg.pojo.History;
import com.lxg.service.historyService.HistoryShowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class HistoryShowServiceImpl implements HistoryShowService {
    @Autowired
    HistoryDao historyDao;


    /**
     * 查询全部借阅的历史记录
     * @return allHistory
     */
    @Override
    public ArrayList<History> getAllHistory() {
        ArrayList<History> allHistory = historyDao.getAllHistory();
        return allHistory;
    }


    /**
     * 查询全部未还借阅记录
     * @return allBorrowing
     */
    @Override
    public ArrayList<History> getAllBorrowing() {
        ArrayList<History> allBorrowing = historyDao.getAllBorrowing();
        return allBorrowing;
    }


    /**
     * 查询全部已还借阅记录
     * @return allReturned
     */
    @Override
    public ArrayList<History> getAllReturned() {
        ArrayList<History> allReturned = historyDao.getAllReturned();
        return allReturned;
    }


    /**
     * 根据uid查询该用于所有借阅记录
     * @param uid
     * @return allHistoryByUid
     */
    @Override
    public ArrayList<History> getAllHistoryByUid(Integer uid) {
        ArrayList<History> allHistoryByUid = historyDao.getAllHistoryByUid(uid);
        return allHistoryByUid;
    }


    /**
     * 根据uid查询全部未还借阅记录
     * @return allBorrowingByUid
     */
    @Override
    public ArrayList<History> getAllBorrowingByUid(Integer uid) {
        ArrayList<History> allBorrowingByUid = historyDao.getAllBorrowingByUid(uid);
        return allBorrowingByUid;
    }


    /**
     * 根据uid查询全部已还借阅记录
     * @return allReturnedByUid
     */
    @Override
    public ArrayList<History> getAllReturnedByUid(Integer uid) {
        ArrayList<History> allReturnedByUid = historyDao.getAllReturnedByUid(uid);
        return allReturnedByUid;
    }

    /**
     * 根据hid查询历史记录
     * @return historyByHid
     */
    @Override
    public History getHistoryByHid(Integer hid) {
        History historyByHid = historyDao.getHistoryByHid(hid);
        return historyByHid;
    }

    @Override
    public ArrayList<History> getAllHistoryByStatus() {
        ArrayList<History> histories = historyDao.getAllHistoryByStatus();
        return histories;
    }

    @Override
    public ArrayList<History> getAllHistoryByLikeBookName(String bookname) {
        ArrayList<History> histories = historyDao.getAllHistoryByLikeBookName(bookname);
        return histories;
    }
}
